home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1992 April / 1992-04.d64 / trapezium rule (.txt) < prev   
Commodore BASIC  |  2022-09-20  |  266b  |  18 lines

  1. 10 rem -- trapezium rule --
  2. 20 print"[147]"
  3. 30 def fna(x)=1/x
  4. 40 print"[215]hat range:x-low,x-high?";
  5. 50 input xl,xh
  6. 60 print"[200]ow many strips";
  7. 70 input n
  8. 80 h=(xh-xl)/n
  9. 90 s=fna(xl)/2
  10. 100 x=xl
  11. 110 for j=1 to n-1
  12. 120 x=x+h
  13. 130 s=s+fna(x)
  14. 140 next j
  15. 150 s=s+fna(xh)/2
  16. 160 a=s*h
  17. 170 print"area is ";a
  18.